/*
 * Created by SharpDevelop.
 * User: michaelo
 * Date: 18/08/2004
 * Time: 15:14
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Windows.Forms;

namespace Orz.LogManager 
{
	/// <summary>
	/// Description of FilterForm.	
	/// </summary>
	public class FilterForm : FindForm
	{
		private const int BUTTON_RESIZE_AMOUNT_H = 48;
		
		private FilterForm ()
		{
			
		}
		
		public FilterForm (Finder finder_p) : base (finder_p)
		{
			InitialiseFilterForm();
		}
		
		
		
		protected override void CmdFindPrevClick(object sender, System.EventArgs e)
		{
			base.CmdFindPrevClick (sender, e);
			Filterer f = (Filterer) finder_i;
			f.Mode = FilterMode.KeepOnlyMatchingLines;
		}
		
		protected override void CmdFindNextClick(object sender, System.EventArgs e)
		{
			base.CmdFindNextClick (sender, e);
			Filterer f = (Filterer) finder_i;
			f.Mode = FilterMode.RemoveMatchingLines;
		}
		
		
		protected void InitialiseFilterForm ()
		{
			this.Width += BUTTON_RESIZE_AMOUNT_H;
			this.cmdCancel.Width += BUTTON_RESIZE_AMOUNT_H;
			this.cmdFindPrev.Width += BUTTON_RESIZE_AMOUNT_H;
			this.cmdFindNext.Width += BUTTON_RESIZE_AMOUNT_H;
			
		 	lblFind.Text = "&Filter:";
			this.cmdFindPrev.Text = "Keep only matching lines";
			this.cmdFindNext.Text = "Remove matching lines";
			this.chkWrapSearches.Visible = false;
			this.Text = "Filter";
		}
	}
}
